home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: Bradd W. Szonye <bradds@ix.netcom.com>
- Newsgroups: comp.lang.c++
- Subject: RE: [HELP!] What's wrong with this code (anachronism)?
- Date: 20 Apr 1996 16:24:59 GMT
- Organization: Netcom
- Message-ID: <01bb2ed6.5da082e0$65c2b7c7@Zany.localhost>
- References: <joe.829611382@babel.ho.att.com>
- NNTP-Posting-Host: det-mi3-05.ix.netcom.com
- X-NETCOM-Date: Sat Apr 20 11:24:59 AM CDT 1996
- X-Newsreader: Microsoft Internet News
-
-
- On Monday, April 15, 1996, Joe Orost wrote...
- > "StmtDG.h", line 9: Warning (Anachronism): StmtDG::SDG_Node is not
- > accessible from StmtDG::SDG_Edge.
- > "StmtDG.h", line 9: Note: Type "CC -migration" for more on anachronisms.
- > "StmtDG.h", line 14: Warning (Anachronism): StmtDG::SDG_Edge is not
- > accessible from StmtDG::SDG_Node.
- > "StmtDG.h", line 32: Warning (Anachronism): StmtDG::SDG_Node is not
- > accessible from StmtDG_Tsort::SDG_TNode.
- >
- > 1 #include "D.h"
- > 2
- > 3 class StmtDG {
- > 4 protected:
- > 5 class SDG_Node;
- > 6 class SDG_Edge {
- > 7 public:
- > 8 SDG_Edge *next;
- > 9 StmtDG::SDG_Node *edge;
- > 10 };
- > 11 class SDG_Node {
- > 12 public:
- > 13 SDG_Node *next;
- > 14 StmtDG::SDG_Edge *edges;
- > 15 AST_INDEX node;
- > 16 int indegree;
- > 17 };
- > 18 SDG_Node *first;
- > 19 int nodes;
- > 20 public:
- > 21 friend class StmtDG_Tsort;
- > 22 StmtDG();
- > 23 ~StmtDG();
- > 24 void add(AST_INDEX node);
- > 25 void add_edge(AST_INDEX source, AST_INDEX sink);
- > 26 };
- > 27
- > 28 class StmtDG_Tsort {
- > 29 class SDG_TNode {
- > 30 public:
- > 31 SDG_TNode *next;
- > 32 StmtDG::SDG_Node *node;
- > 33 };
- > 34 SDG_TNode *head, *cur;
- > 35 public:
- > 36 StmtDG_Tsort(StmtDG SDG);
- > 37 ~StmtDG_Tsort();
- > 38 AST_INDEX cur_stmt();
- > 39 void operator ++();
- > 40 };
- >
- > Please send email.
- >
- > regards,
- > joe
- >
- [emailed to author:]
- Nested classes obey the same access rules as non-member functions.
- Therefore, only entities with "protected" access to StatementDG's (friends
- and derived classes) can access the protected nested class SDG_Node.
- SDG_Edge is not a friend or derived class of StatementDG, therefore it
- does not have access to the nested class SDG_Node. To fix this, either
- make SDG_Edge and SDG_Node friends of StatementDG or put their class
- definitions in StatementDG's "public" access section.
-
-
-